import {LoginEvent} from "../LoginEvent.ts";
import {BaseSeqCommand} from "../../../v-cairn/BaseSeqCommand.ts";
import type {AxiosResponse} from "v-cairn";
import {VCairnEvent} from "v-cairn";

export class GetUserInfo2Command extends BaseSeqCommand {
    constructor() {
        super();
        this.nextEvents = [
            new VCairnEvent(LoginEvent.LOGIN_COMPLETE)
        ];
    }

    execute(event: VCairnEvent) {
        this.service.send({
            url: `/posts/${event.data}`,
        });
    }

    protected onSuccess(response:AxiosResponse) {
        console.log('2', response.data);
        this.executeNextCommands();
    }
}